import request from "@/util/request"
// 注册
export const userRegisterServer = ({ username, password, repassword }) => {
    return request.post("/api/reg", { username, password, repassword })
}

//登录
export const userLoginServer = ({ username, password }) => {
    return request.post('/api/login', { username, password })
}

// 获取个人信息
export const getUserInfoServer = () => {
    return request.get('/my/userinfo')
}

// 修改个人信息

export const userUpdateInfoService = ({ id, nickname, email }) =>
    request.put('/my/userinfo', { id, nickname, email })

// 上传头像
export const userUploadAvatarService = (avatar) => request.patch('/my/update/avatar', { avatar })

// 重置密码

export const userUpdatePassService = ({ old_pwd, new_pwd, re_pwd }) =>
    request.patch('/my/updatepwd', { old_pwd, new_pwd, re_pwd })